﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class news_ModuleCalendarDelete : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            try
            {
                int id = Convert.ToInt32(Request["id"]);
                CMSModel.CMSEntities dal = DAL.DBManager.GetCmsEmtity();
                CMSModel.ModuleCalendar m = dal.ModuleCalendar.First(x => x.id == id);
                dal.DeleteObject(m);
                dal.SaveChanges();
                ClientScript.RegisterStartupScript(GetType(), "success", "alert('删除成功');document.location='ModuleCalendar.aspx'", true);
            }
            catch (Exception)
            {
                ClientScript.RegisterStartupScript(GetType(), "success", "alert('删除失败');", true);
            }
        }
    }
}